/*******************************************************************************
** www.IfcGears.com                                                           **
** Copyright (C) 2010 - Bauhaus University Weimar, www.uni-weimar.de          **
** Written: 2010-10-02, Fabian Gerold, www.fabiangerold.de                    **
*******************************************************************************/

#pragma once

#include <QtGui>
#include <set>

class Attribute;
class IfcGears;
class IfcRelease;

class Entity
{
public:
	Entity( IfcGears* gears );

	QString getSuperTypeName() { return m_supertype_name; }
	shared_ptr<Entity>  getSuperType() { return m_supertype; }
	int getNumAttributesIncludingSupertypes();

	QString getCodeHeader();
	QString getCodeCpp();
	QString getClassDeclaration();
	QString getCodeSetEntity();
	QString getCodeWriterEntity();
	QString getCodeUnlink() { return m_unlink_cpp; }
	QString getAttributeDeclaration( int num_tabs, bool as_comment = false );
	
	bool setSchema( QString schema );
	void setSchemaVersion( QString schema_version, shared_ptr<IfcRelease> ifc_release );
	QString getSchemaVersion() { return m_schema_version; }
	bool parse();
	bool parseInverse( QString inv_code );
	//void generateCodeUnlink();
	QString getEntityReader( bool lowermost, int& iarg );
	int getStrlenAttributesTypes();
	int getStrlenAttributesTypesAndNames();
	
	bool setSchemaType( QString schema );
	bool setSchemaEntity( QString schema );
	void getAllSuperClasses( QStringList& all_super_classes );
	void getAllSelectClasses( QStringList& all_select_classes );
	void getAllAttributes( QStringList& set_all_attributes, bool include_inherited );
	void linkDependencies();

	IfcGears*					m_gears;
	shared_ptr<IfcRelease>		m_ifc_release;
	QString						m_classname;
	QString 					m_schema;
	QString 					m_supertype_name;

	shared_ptr<Entity>  		m_supertype;
	QString						m_unlink_cpp;

	QStringList 				m_enums;
	QStringList 				m_select;
	QStringList					m_select_supertypes;
	std::vector<shared_ptr<Attribute> > 	m_attributes;
	std::vector<shared_ptr<Attribute> > 	m_inverse_attributes;

private:
	QString						m_schema_version;
};
